
//
//  MXNewViewTitleMenuTableViewController.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/19.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//

#import "MXNewViewTitleMenuTableViewController.h"
#import "AFNetworkHandler.h"
#import "MXNewViewTitleMenuModel.h"
@interface MXNewViewTitleMenuTableViewController ()
@property (nonatomic, retain) NSMutableArray *itemAray;
@end

@implementation MXNewViewTitleMenuTableViewController
- (void)dealloc
{
    [_itemAray release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewStyle)style
{
    if (self = [super initWithStyle:style]) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.itemAray = [NSMutableArray array];
    
    
    [self getData];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete method implementation.
    // Return the number of rows in the section.
    return self.itemAray.count;
}






- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleSubtitle) reuseIdentifier:@"cell"];
    }
    
    cell.textLabel.text  = self.itemAray[indexPath.row];
    
    return cell;
}

- (void)getData
{
    NSString *Path = @"http://rm.app.hongniujia.com/json_shop.php?action=category&appCookie=channel_AppStore%20version_6.11%20oid_AE53CF37-EAEB-468C-8507-15A922FDD348%20package_com.aslibra.rm.nanren%20platform_iphone%20ver_8.4.1%20jb_0%20t1_1439954228%20md5_88%20t_1438671553";
    [AFNetworkHandler GETwithAFNByURL:Path completion:^(id result) {
        
        NSArray *dataArr = result;
        for (NSDictionary *dict in dataArr) {
            MXNewViewTitleMenuModel *model = [[[MXNewViewTitleMenuModel alloc] initWithDic:dict] autorelease];
            [self.itemAray addObject:model];
        }
    }];
}

@end
